home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / devices / msh_1_5 / part01 / src / ignore.c < prev    next >
C/C++ Source or Header  |  1990-02-21  |  2KB  |  71 lines

  1. /*
  2.  *  IGNORE.C
  3.  *
  4.  *  Makes it possible to ignore CRC errors.
  5.  *
  6.  *  This code is (C) Copyright 1989 by Olaf Seibert. All rights reserved.
  7.  *  May not be used or copied without a licence.
  8.  */
  9.  
  10. #include "dev.h"
  11. #include "device.h"
  12.  
  13.  
  14. main(argc, argv)
  15. int argc;
  16. char **argv;
  17. {
  18.     struct MsgPort *port, *CreatePort();
  19.     struct IOExtTD *tdreq, *CreateExtIO();
  20.     UNIT *unit;
  21.     long unitnr;
  22.     int yesno;
  23.  
  24.     if (argc < 2) {
  25.     Puts("Usage: ignore <unitnr> <YES/NO>\n");
  26.     Puts("       If Yes, CRC errors will be ignored.\n");
  27.     exit(1);
  28.     }
  29.  
  30.     unitnr = atoi(argv[1]);
  31.     /*
  32.      *    Don't be misled by the name CRC_UNCHECKED.
  33.      *    It means the opposite happens.
  34.      */
  35.     if (argc > 2)
  36.     yesno = ((argv[2][0] & 0x5F) == 'Y') ? TDERR_NoError : CRC_UNCHECKED;
  37.     else
  38.     yesno = -42;
  39.  
  40.     if (port = CreatePort(NULL, 0L)) {
  41.     if (tdreq = CreateExtIO(port, (long)sizeof(*tdreq))) {
  42.         OpenDevice("messydisk.device", unitnr, tdreq, 0L);
  43.         if (tdreq->iotd_Req.io_Device) {
  44.         unit = (UNIT *)tdreq->iotd_Req.io_Unit;
  45.         if (yesno != -42)
  46.             unit->mu_InitSectorStatus = yesno;
  47.         else if (unit->mu_InitSectorStatus == CRC_UNCHECKED)
  48.             Puts("No\n");
  49.         else
  50.             Puts("Yes\n");
  51.         CloseDevice(tdreq);
  52.         } else
  53.         Puts("Cannot OpenDevice messydisk\n");
  54.         DeleteExtIO(tdreq);
  55.     } else
  56.         Puts("No memory for I/O request\n");
  57.     DeletePort(port);
  58.     } else
  59.     Puts("No memory for replyport\n");
  60. }
  61.  
  62. Puts(string)
  63. char *string;
  64. {
  65.     long Output();
  66.  
  67.     Write(Output(), string, (long)strlen(string));
  68. }
  69.  
  70. _wb_parse(){}
  71.